package com.api.server.service.impl;

import com.api.server.mapper.UserMapper;
import com.api.server.pojo.User;
import com.api.server.pojo.Zfadministrator;
import com.api.server.mapper.ZfadministratorMapper;
import com.api.server.service.IZfadministratorService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author shi
 * @since 2022-04-28
 */
@Service
public class ZfadministratorServiceImpl extends ServiceImpl<ZfadministratorMapper, Zfadministrator> implements IZfadministratorService {

    @Autowired
    private PasswordEncoder passwordEncoder;

    @Autowired
    private UserMapper userMapper;


    @Override
    public void registercontroller(Zfadministrator zfadministrator) {

        zfadministrator.setUserpassword(passwordEncoder.encode(zfadministrator.getUserpassword()));
        zfadministrator.setUsergrade("2");
        userMapper.insert(zfadministrator);
    }
}
